import http from "../../utils/requestAI";
import type { AccountAdd, AccountList, AccountParams, UserInfoData } from "./type";

// 账号列表
export const getAccount=(params?:AccountParams)=>{

  return  http.get<AccountList>('/account/list',params);

}


export const delAccount=(id:number)=>{

    console.log('删除1111',id);

    return  http.delete(`/account/delete/${id}`);
  
}

export const delAccounts=(ids:number[])=>{

    console.log('删除222',ids);

    return  http.post(`/account/deleteAll/`,ids);
  
}

// 添加表单
export const addAccount=(data:AccountAdd)=>{

    console.log('添加',data);
    return  http.post(`/account/add`,data);

}


// 获取登录账号信息
export const getUserInfo=()=>{
    return  http.get<UserInfoData>(`/account/getUserInfo`);
}

// 修改登录账号密码
export const updateUserPwd=(data:{pwd:string,newPwd:string})=>{
    return  http.put(`/account/updatePwd`,data);
}

// 修改头像
export const updateUserPhoto=(data:{photo:string})=>{
    return  http.put<UserInfoData>(`/account/updatePhoto`,data);
}